package com.rede.didiok.user.modulelist.rank.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.rede.didiok.common.utils.PageUtils;
import com.rede.didiok.common.utils.R;
import com.rede.didiok.user.modulelist.rank.entity.AttrInfoEntity;
import com.rede.didiok.user.modulelist.rank.service.AttrInfoService;


/**
 * 活动对应的属性信息
 *
 * @author Rede
 * @email didiok@foxmail.com
 * @date 2024-02-20 15:43:51
 */
@RestController
@RequestMapping("rank/attrinfo")
public class AttrInfoController {
    @Autowired
    private AttrInfoService attrInfoService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    // @RequiresPermissions("rank:attrinfo:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = attrInfoService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{uid}")
    // @RequiresPermissions("rank:attrinfo:info")
    public R info(@PathVariable("uid") String uid){
		AttrInfoEntity attrInfo = attrInfoService.getById(uid);

        return R.ok().put("attrInfo", attrInfo);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    // @RequiresPermissions("rank:attrinfo:save")
    public R save(@RequestBody AttrInfoEntity attrInfo){
		attrInfoService.save(attrInfo);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    // @RequiresPermissions("rank:attrinfo:update")
    public R update(@RequestBody AttrInfoEntity attrInfo){
		attrInfoService.updateById(attrInfo);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    // @RequiresPermissions("rank:attrinfo:delete")
    public R delete(@RequestBody String[] uids){
		attrInfoService.removeByIds(Arrays.asList(uids));

        return R.ok();
    }

}
